import unittest,requests
from ddt import ddt,data,file_data,unpack

class Moive(unittest.TestCase):

    host='http://10.59.9.18'
    userId=None
    sessionId=None
    #登录 login
    def test_01_login(self):
        url=Moive.host+'/movieApi/user/v2/login'
        json={'email':'3601552946@qq.com','pwd':'eWLPHopE945d2ivttHaQTQ=='}
        login=requests.post(url=url,data=json)
        print(login.json())
        Moive.userId=login.json()['result']['userId']
        print(Moive.userId)
        Moive.sessionId=login.json()['result']['sessionId']
        print(Moive.sessionId)

    #跳过
    @unittest.skip
    # 查询看过的电影 seemoive
    def test_03_seemovie(self):
        url = Moive.host + '/movieApi/user/v2/verify/findSeenMovie'
        headers = {'userId': str(Moive.userId), 'sessionId': Moive.sessionId}
        seemoive=requests.get(url=url,headers=headers)
        print(seemoive.json())


    #查询热门电影列表 hotmoive
    movieId=None
    def test_04_hotmovie(self):
        url = Moive.host + '/movieApi/movie/v2/findHotMovieList'
        json = {'page': 1, 'count': 5}
        hotmoive=requests.get(url=url,params=json)
        print(hotmoive.json())
        Moive.movieId=hotmoive.json()['result'][0]['movieId']
        print(Moive.movieId)

    #关注电影 follow
    def test_05_follow(self):
        url = Moive.host + '/movieApi/movie/v1/verify/followMovie'
        headers = {'userId': str(Moive.userId), 'sessionId': Moive.sessionId}
        json={'movieId':Moive.movieId}
        foolow=requests.get(url=url,headers=headers,params=json)
        print(foolow.json())

    #查询用户关注电影列表 followmoive
    def test_06_followmoive(self):
        url = Moive.host + '/movieApi/user/v2/verify/findUserFollowMovieList'
        headers = {'userId': str(Moive.userId), 'sessionId': Moive.sessionId}
        json= {'page': 1, 'count': 5}
        followmoive=requests.get(url=url,headers=headers,params=json)
        print(followmoive.json())




#执行
if __name__ == '__main__':
    unittest.main()